//
//  loginViewController.swift
//  万才信息App
//
//  Created by 陌上互联  on 16/7/13.
//  Copyright © 2016年 万才信息. All rights reserved.
//

import UIKit

//登录界面
class loginViewController: UIViewController {
    
    @IBOutlet weak var tvUserName: UITextField!
    @IBOutlet weak var tvPassword: UITextField!
    
    @IBAction func pressLoginButton(sender: AnyObject) {
//        let userName=tvUserName.text!
//        let passWord=tvPassword.text!
        let userName="st1"
        let passWord="1"
        
//        TODO 登录的等待
        let waitingAlert=waitingAlertUtil(msg: "登录中....")
        waitingAlert.show(self)
        
//        发送登录请求
        loginAndRegister.userLogin(userName, pwd: passWord, successCallback: { (userId) in
//            登录成功！
            waitingAlert.stop()
//            跳转到主页面
            self.performSegueWithIdentifier("loginSuccess", sender: self)
//            waitingAlert.stop()
            }) { (error) in
//                登录失败！
                waitingAlert.stop()
                warningAlertUtil(title: "登录失败",msg: error).show(self)
        }
    }
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
//        enumUtil.getAllEnum()
        
//        测试获取职业列表
        jobManager.GetJobs(25, pageIndex: 0, industryId: 0, jobFunctionId: 0, workLocationId: 0, keywords: "", degreeId: 0, workexperienceId: 0, salaryRangeId: 0, jobNatureId: 0, successCallback: { (theRetList) in
            print("获取职业列表成功")
            print(theRetList)
            }) { (error) in
                print(error)
        }
        
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


}

